const {
  DataTypes
} = require('sequelize');
module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.BIGINT,
      allowNull: false,
      defaultValue: null,
      comment: "主键",
      primaryKey: true,
      field: "id",
      autoIncrement: false
    },
    title: {
      type: DataTypes.CHAR,
      allowNull: true,
      defaultValue: null,
      comment: "通知标题",
      primaryKey: false,
      field: "title",
      autoIncrement: false
    },
    content: {
      type: DataTypes.TEXT,
      allowNull: true,
      defaultValue: null,
      comment: "通知内容",
      primaryKey: false,
      field: "content",
      autoIncrement: false
    },
    type: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: null,
      comment: "通知类型（字典code：notice_type）",
      primaryKey: false,
      field: "type",
      autoIncrement: false
    },
    level: {
      type: DataTypes.CHAR,
      allowNull: false,
      defaultValue: null,
      comment: "通知等级（字典code：notice_level）",
      primaryKey: false,
      field: "level",
      autoIncrement: false
    },
    target_type: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: null,
      comment: "目标类型（1: 全体, 2: 指定）",
      primaryKey: false,
      field: "target_type",
      autoIncrement: false
    },
    target_user_ids: {
      type: DataTypes.CHAR,
      allowNull: true,
      defaultValue: null,
      comment: "目标人ID集合（多个使用英文逗号,分割）",
      primaryKey: false,
      field: "target_user_ids",
      autoIncrement: false
    },
    publisher_id: {
      type: DataTypes.BIGINT,
      allowNull: true,
      defaultValue: null,
      comment: "发布人ID",
      primaryKey: false,
      field: "publisher_id",
      autoIncrement: false
    },
    publish_status: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: null,
      comment: "发布状态（0: 未发布, 1: 已发布, -1: 已撤回）",
      primaryKey: false,
      field: "publish_status",
      autoIncrement: false
    },
    publish_time: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: null,
      comment: "发布时间",
      primaryKey: false,
      field: "publish_time",
      autoIncrement: false
    },
    revoke_time: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: null,
      comment: "撤回时间",
      primaryKey: false,
      field: "revoke_time",
      autoIncrement: false
    },
    create_by: {
      type: DataTypes.BIGINT,
      allowNull: false,
      defaultValue: null,
      comment: "创建人ID",
      primaryKey: false,
      field: "create_by",
      autoIncrement: false
    },
    create_time: {
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: null,
      comment: "创建时间",
      primaryKey: false,
      field: "create_time",
      autoIncrement: false
    },
    update_by: {
      type: DataTypes.BIGINT,
      allowNull: true,
      defaultValue: null,
      comment: "更新人ID",
      primaryKey: false,
      field: "update_by",
      autoIncrement: false
    },
    update_time: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: null,
      comment: "更新时间",
      primaryKey: false,
      field: "update_time",
      autoIncrement: false
    },
    is_deleted: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: null,
      comment: "是否删除（0: 未删除, 1: 已删除）",
      primaryKey: false,
      field: "is_deleted",
      autoIncrement: false
    }
  };
  const options = {
    tableName: "sys_notice",
    modelName: 'SysNoticeModel',
    comment: "",
    indexes: []
  };
  const SysNoticeModel = sequelize.define("sys_notice_model", attributes, options);
  return SysNoticeModel;
};